// This file was decompiled using SASCM.ini published by GTAG (http://gtag.gtagaming.com/opcode-database) on 14.6.2013
{$CLEO .cs}

//-------------MAIN---------------
thread 'UTON'

const         
   index      = 6@
   vhandle    = 0@
   model_id   = 4@
   ped_health = 5@
   phandle    = 7@
   ran        = 8@
   color_id   = 12@
   tm_addres  = 13@
end

 //- Traffic is Fast Cars


WHILE TRUE
    WAIT 0
    Actor.StorePos($PLAYER_ACTOR, 1@, 2@, 3@)
    if 0AE1: phandle = random_actor_near_point 1@ 2@ 3@ in_radius 80.0 find_next 1 pass_deads 0 //IF and SET                                                                  
    JF continue     
    if and                                                                        
        056D:   actor phandle defined                                                 
        803B:   not  phandle == $PLAYER_ACTOR // (int)                                
    JF continue //func hack cath only one ped and his vehicle dont repeat 
    vhandle = Actor.CurrentCar(phandle)                                            
    //IF //847A:   not actor phandle driving_bike                                          
    //THEN                                                                                 
        if Actor.InCar(phandle, vhandle)                                                   
        THEN                                                                                                                                         
            if 056E:   car vhandle defined                                                                                                   
            THEN                                                                                                                                 
                IF not Car.HasHydraulics(vhandle)                                          
                THEN Car.ToggleHydraulics(vhandle) = True
                    if not vhandle == 0x0                                                                                                                                                   
                    then                                                                                                                                                                 
                        0A97: tm_addres = car vhandle struct                                                                                                                                
                        if not tm_addres == 0x0                                                                                                                                          
                        then                                                                                                                                                             
                            tm_addres += 0x384 // vehicle.pHandling                                                                                                                      
                            0A8D: tm_addres = read_memory tm_addres size 4 virtual_protect 0 // pegar o ponteiro do handling do carro                                                    
                            tm_addres  += 0xAC //= fSuspensionForceLevel                                                                                                                 
                            0A8C: write_memory tm_addres size 4 value 0.45  virtual_protect 0                                                                                              
                        END
                    END
                    if 847A:   not actor phandle driving_bike
                    THEN        
                        0AB3: 244 > vhandle //SEND VEH HANDLER                                                    
                        0A92: create_custom_thread "14FA51F5D0\NEON_HOOK.CS"
                    END                                         
                    if 89AE:   actor phandle driving_train //FIXED CRASH                                
                    then                                                                   
                        0ab1: @mount_component 2 vhandle vhandle //push                    
                    end                                                                    
                    if and                                                                 
                        847A:   not actor phandle driving_bike                             
                        89AE:   actor phandle driving_train                                
                    then                                                                   
                        0ab1: @mount_wheels 2 vhandle vhandle //push                       
                    end                                                                    
                    0ab1: @mount_paintjob 2 vhandle vhandle //push                         
                END                                                                        
            end                                                                            
        end                                                                                
    //end                                                                                  
    
END

:mount_component
for index = 0 to 16 step 1
    06E5: get_car vhandle possible_to_built_in_component_pool_index 0 itemID_to model_id                                                                    
    if and                                                                                                                                                       
       not model_id == -1                                                                                                                                       
       not model_id == 1086                                                                                                                                     
       not model_id == 0                                                                                                                                        
    then                                                                                                                            
        if not index >= 16                                                                                                                                                                                                                                           
        then                                                                                                                                                     
            06E5: get_car vhandle possible_to_built_in_component_pool_index index itemID_to model_id                                                                
            if and                                                                                                                                                                                                                                                       
               not model_id == -1                                                                                                                                   
               not model_id == 1086                                                                                                                                 
            then                                                                                                          
                if and                                                                                       
                  not model_id == -1                                                                        
                  not model_id == 0
                  model_id > 900                                                                                        
                then                                                                                         
                    06E9: load_car_component model_id                                                       
                    038B: load_requested_models                                                              
                    if 06EA:   car_component model_id available                                                
                    then
                        06E7: 21@ = add_car_component model_id to_car vhandle                                       
                        06EB: release_car_component model_id 
                    end                                                                            
                end                                                                                                          
            end                                                                                                              
        end                                                                                                                  
    end
end
0ab2: 0

:mount_wheels
0209: ran = random_int_in_ranges 1 17 
if ran == 1                                                                                                                                    
then model_id = 1025//
    goto @mount                                                                                                                           
else                                                                                                                                                
    if ran == 2                                                                                                                                    
    then model_id = 1073//                                                                                                                          
        goto @mount                                                                                              
    else                                                                                                                                             
        if ran == 3                                                                                                                                    
        then model_id = 1074//                                                                                                                          
             goto @mount                                                                                            
        else                                                                                                                                              
            if ran == 4                                                                                                                                    
            then model_id = 1075//                                                                                                                          
                goto @mount                                                                                                  
            else                                                                                                                                              
                if ran == 5                                                                                                                                    
                then model_id = 1076//                                                                                                                          
                    goto @mount                                                                                                          
                else                                                                                                                                              
                    if ran == 6                                                                                                                                    
                    then model_id = 1077//                                                                                                                          
                        goto @mount                                                                                                       
                    else                                                                                                                                              
                        if ran == 7                                                                                                                                    
                        then model_id = 1078//                                                                                                                          
                            goto @mount                                                                                                      
                        else                                                                                                                                              
                            if ran == 8                                                                                                                                    
                            then model_id = 1079 //                                                                                                                         
                                goto @mount                                                                                             
                            else                                                                                                                                              
                                if ran == 9                                                                                                                                    
                                then model_id = 1080//                                                                                                                          
                                    goto @mount                                                                                                        
                                else                                                                                                                                              
                                    if ran == 10                                                                                                                                   
                                    then model_id = 1081//                                                                                                                          
                                        goto @mount                                                                                                           
                                    else                                                                                                                                              
                                        if ran == 11                                                                                                                                   
                                        then model_id = 1082//                                                                                                                          
                                            goto @mount                                                                                                       
                                        else                                                                                                                                              
                                            if ran == 12                                                                                                                                   
                                            then model_id = 1083//                                                                                                                          
                                                goto @mount                                                                                                          
                                            else                                                                                                                                              
                                                if ran == 13                                                                                                                                   
                                                then model_id = 1084//                                                                                                                          
                                                    goto @mount                                                                                                      
                                                else                                                                                                                                              
                                                    if ran == 14                                                                                                                                   
                                                    then model_id = 1085//                                                                                                                          
                                                        goto @mount                                                                                          
                                                    else                                                                                                                                              
                                                        if ran == 15                                                                                                                                   
                                                        then model_id = 1096//                                                                                                                          
                                                            goto @mount                                                                                                        
                                                        else                                                                                                                                              
                                                            if ran == 16                                                                                                                                   
                                                            then model_id = 1097//                                                                                                                          
                                                                goto @mount                                                                                                          
                                                            else                                                                                                                                              
                                                                if ran == 17                                                                                                                                   
                                                                then model_id = 1098//                                                                                                                          
                                                                    goto @mount                                                                                                       
                                                                end                                   
                                                            end                                       
                                                        end                                           
                                                    end                                               
                                                end                                                   
                                            end                                                       
                                        end                                                           
                                    end                                                               
                                end                                                                   
                            end                                                                       
                        end                                                                           
                    end                                                                               
                end                                                                                   
            end                                                                                       
        end
    end
end
goto @s
            
:mount                                                                                                                                                                                                                                                                   
if and                                                                                                                                                              
   not model_id == -1                                                                                                                                               
   not model_id == 1086                                                                                                   
then                                                                                                         
    if and                                                                                                  
      not model_id == -1                                                                         
      not model_id == 0                                                                                                 
      model_id > 900                                                                                         
    then                                                                                                    
        06E9: load_car_component model_id                                                                    
        038B: load_requested_models                                                                            
        if 06EA:   car_component model_id available                                              
        then                                                                                                        
            06E7: 21@ = add_car_component model_id to_car vhandle                                
            06EB: release_car_component model_id                                                   
        end                                                                                                                  
    end                                                                                          
end                                                                                  
:s                                                                                                           
0ab2: 0

:mount_paintjob
06EC: get_car vhandle number_of_possible_paintjobs_to 10@ 
if not 10@ == 0
then
    0209: ran = random_int_in_ranges 1 4 
    if ran == 1                                                                                                          
    then                                                                                                                   
        06ED: set_car vhandle paintjob 0                                                                               
    end                                                                                                                    
    if ran == 2                                                                                                          
    then                                                                                                                   
        06ED: set_car vhandle paintjob 1                                                       
    end                                                                                                                    
    if ran == 3                                                                                                          
    then                                                                                                                   
        06ED: set_car vhandle paintjob 2                                                       
    end                                                                                                                    
    if ran == 4                                                                                                          
    then                                                                                                                   
        06ED: set_car vhandle paintjob 3                                                       
    end
else
    0209: ran = random_int_in_ranges 1 16                                                                                                                                                                 
    if ran == 1                                                                                                   
    then                                                                                                              
        color_id =  219                             
    end                                                                     
    if ran == 2                                                        
    then                                                                   
        color_id =  220                             
    end                                                                     
    if ran == 3                                                        
    then                                                                  
        color_id =  222                             
    end                                                                     
    if ran == 4                                                        
    then                                                                   
        color_id =  224                             
    end                                                                     
    if ran == 5                                                        
    then                                                                  
        color_id =  226                             
    end                                                                     
    if ran == 6                                                        
    then                                                                     
        color_id =  229                             
    end                                                                     
    if ran == 7                                                        
    then                                                                
        color_id =  252                             
    end                                                                     
    if ran == 8                                                        
    then                                                                  
        color_id =  253                             
    end                                                                     
    if ran == 9                                                        
    then                                                                 
        color_id =  254                             
    end
    if ran == 10                                                                                                   
    then                                                                                                              
        color_id =  5                       
    end                                                                 
    if ran == 11                                                    
    then                                                               
        color_id =  3                       
    end                                                                 
    if ran == 12                                                    
    then                                                              
        color_id =  6                       
    end                                                                 
    if ran == 13                                                    
    then                                                               
        color_id =  85                        
    end                                                                 
    if ran == 14                                                    
    then                                                              
        color_id =  86                        
    end                                                                                                                
    if ran == 15                                                                                                   
    then                                                                                                                
        color_id =  126                        
    end                                                                
    if ran == 16                                                   
    then                                                           
        color_id =  127                        
    end                                                                                                                
    03F3: get_car vhandle primary_color_to 13@ secondary_color_to 11@ 
    0229: set_car vhandle primary_color_to color_id secondary_color_to 11@ 
    0209: ran = random_int_in_ranges 1 16                                                                                                                                                                  
    if ran == 1                                                                                                   
    then                                                                                                              
        color_id =  219                             
    end                                                                     
    if ran == 2                                                        
    then                                                                   
        color_id =  220                             
    end                                                                     
    if ran == 3                                                        
    then                                                                  
        color_id =  222                             
    end                                                                     
    if ran == 4                                                        
    then                                                                   
        color_id =  224                             
    end                                                                     
    if ran == 5                                                        
    then                                                                  
        color_id =  226                             
    end                                                                     
    if ran == 6                                                        
    then                                                                     
        color_id =  229                             
    end                                                                     
    if ran == 7                                                        
    then                                                                
        color_id =  252                             
    end                                                                     
    if ran == 8                                                        
    then                                                                  
        color_id =  253                             
    end                                                                     
    if ran == 9                                                        
    then                                                                 
        color_id =  254                             
    end
    if ran == 10                                                                                                   
    then                                                                                                              
        color_id =  5                       
    end                                                                 
    if ran == 11                                                    
    then                                                               
        color_id =  3                       
    end                                                                 
    if ran == 12                                                    
    then                                                              
        color_id =  6                       
    end                                                                 
    if ran == 13                                                    
    then                                                               
        color_id =  85                        
    end                                                                 
    if ran == 14                                                    
    then                                                              
        color_id =  86                        
    end                                                                                                                
    if ran == 15                                                                                                   
    then                                                                                                                
        color_id =  126                        
    end                                                                
    if ran == 16                                                   
    then                                                           
        color_id =  127                        
    end                                                                                                                
    03F3: get_car vhandle primary_color_to 11@ secondary_color_to 13@ 
    0229: set_car vhandle primary_color_to 11@ secondary_color_to color_id                                                                                                                          
end         
0ab2: 0

